<?php
/*
 * LCMX 4.0 网站简历处理
 * ============================================================================
 * 版权所有: 山西龙采科技，并保留所有权利。
 * 网站地址: http://www.longcai0351.com
 * ============================================================================
 */

$lc_title = isset($_POST['lc_title'])?escape_str($_POST['lc_title']):null;
$lc_sex = isset($_POST['lc_sex'])?escape_str($_POST['lc_sex']):null;
$lc_birthday = isset($_POST['lc_birthday'])?escape_str($_POST['lc_birthday']):null;
$lc_tel = isset($_POST['lc_tel'])?escape_str($_POST['lc_tel']):null;
$lc_sfz = isset($_POST['lc_sfz'])?escape_str($_POST['lc_sfz']):null;
$lc_married = isset($_POST['lc_married'])?escape_str($_POST['lc_married']):null;
$lc_zhicheng = isset($_POST['lc_zhicheng'])?escape_str($_POST['lc_zhicheng']):null;
$lc_school = isset($_POST['lc_school'])?escape_str($_POST['lc_school']):null;
$lc_zhuanye = isset($_POST['lc_zhuanye'])?escape_str($_POST['lc_zhuanye']):null;
$lc_xueli = isset($_POST['lc_xueli'])?escape_str($_POST['lc_xueli']):null;
$lc_address = isset($_POST['lc_address'])?escape_str($_POST['lc_address']):null;
$lc_jiguan = isset($_POST['lc_jiguan'])?escape_str($_POST['lc_jiguan']):null;
$lc_tel = isset($_POST['lc_tel'])?escape_str($_POST['lc_tel']):null;
$lc_zhiwei = isset($_POST['lc_zhiwei'])?escape_str($_POST['lc_zhiwei']):null;
$lc_price = isset($_POST['lc_price'])?escape_str($_POST['lc_price']):null;
$lc_xxjl = isset($_POST['lc_xxjl'])?escape_str($_POST['lc_xxjl']):null;
$lc_gzjl = isset($_POST['lc_gzjl'])?escape_str($_POST['lc_gzjl']):null;
$lc_yaoqiu = isset($_POST['lc_yaoqiu'])?escape_str($_POST['lc_yaoqiu']):null;
$lc_techang = isset($_POST['lc_techang'])?escape_str($_POST['lc_techang']):null;
$lc_ip = getip();//获取ip地址

if($lc_title && $lc_sex && $lc_birthday && $lc_xueli && $lc_tel && $lc_zhiwei){
	$sql = "insert into ".lc()."_jianli (lc_title,lc_sex,lc_birthday,lc_sfz,lc_married,lc_zhicheng,lc_school,lc_zhuanye,lc_xueli,lc_address,lc_jiguan,lc_tel,lc_zhiwei,lc_price,lc_xxjl,lc_gzjl,lc_yaoqiu,lc_techang,lc_datetime) values ('{$lc_title}','{$lc_sex}','{$lc_birthday}','{$lc_sfz}','{$lc_married}','{$lc_zhicheng}','{$lc_school}','{$lc_zhuanye}','{$lc_xueli}','{$lc_address}','{$lc_jiguan}','{$lc_tel}','{$lc_zhiwei}','{$lc_price}','{$lc_xxjl}','{$lc_gzjl}','{$lc_yaoqiu}','{$lc_techang}',NOW())";
	$rs = mysql_query($sql);
	if($rs){
		if(get_config_value('gbook_duanxin_come')==1){
			$con='您有一条名为"'.$lc_title.'"的简历，请尽快登陆后台查看';
			duanxin($con);
		}elseif (get_config_value('job_email_come')==1){
	$gbook_kq =  get_config_value('gbook_email_come');
    $smtpuser = explode("@",get_config_value('email_user')); 		
	
		//使用163邮箱服务器
				$smtpserver = get_config_value('email_zt');
				//163邮箱服务器端口 
				$smtpserverport = get_config_value('email_port');
				//你的163服务器邮箱账号
				$smtpusermail = get_config_value('email_user');
				//收件人邮箱
				$smtpemailto = get_config_value('email_shoujian');
				//你的邮箱账号(去掉@163.com)
				$smtpuser = $smtpuser[0];//SMTP服务器的用户帐号 
				//你的邮箱密码
				$smtppass = get_config_value('email_password'); //SMTP服务器的用户密码 
				
				
				//邮件主题 
				$mailsubject = "来自:{$lc_title}的应聘留言";
				//邮件内容 
				$mailbody = "姓名:$lc_title}
				出生年月:{$lc_birthday}
				电话号:{$lc_tel}
				应聘职位:{$lc_zhiwei}
				毕业院校:{$lc_school}
				最高学历:{$lc_xueli}
				专业:{$lc_zhuanye}
				期望薪金:{$lc_price}
				学习经历:{$lc_xxjl}
				工作经历:{$lc_gzjl}
				对公司要求:{$lc_yaoqiu}
				特长爱好:{$lc_techang}
				";
				//邮件格式（HTML/TXT）,TXT为文本邮件 
				$mailtype = "TXT";
				//这里面的一个true是表示使用身份验证,否则不使用身份验证. 
				$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);
				//是否显示发送的调试信息 
				$smtp->debug = false;
				//发送邮件
				$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
		
	
	
		}
		mx_msg("亲，简历提交成功咯！","index.php?p=jianli");
	}else{
		mx_msg("亲，简历提交失败！","1");
	}
}else{
	mx_msg("亲，必填项不能为空！","1");
}


function duanxin($con){
	$x_eid=get_config_value('x_eid');
	$x_uid=get_config_value('x_uid');
	$x_pwd_md5=get_config_value('x_pwd_md5');
	$x_target_no=get_config_value('x_target_no');
	$x_memo=$con;
	$url="http://gateway.woxp.cn:6630/gb2312/web_api/?x_eid={$x_eid}&x_uid={$x_uid}&x_pwd_md5={$x_pwd_md5}&x_ac=10&x_target_no={$x_target_no}&x_memo={$x_memo}&x_gate_id=300";
	Get($url);
}

function Get($url)
{
	if(function_exists('file_get_contents'))
	{
		$file_contents = file_get_contents($url);
	}
	else
	{
		$ch = curl_init();
		$timeout = 5;
		curl_setopt ($ch, CURLOPT_URL, $url);
		curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
		$file_contents = curl_exec($ch);
		curl_close($ch);
	}
	return $file_contents;
}
?>
